import {Component, OnInit, ViewEncapsulation, ChangeDetectionStrategy} from '@angular/core';
import {PlanService} from "@train/plan/plan.service";
import * as API from "@api/index";
import {Response} from "@angular/http";
import {ActivatedRoute, Params} from "@angular/router";
import {TrainClassScheduleVO} from "@interface/index";

@Component({
  selector: 'plan-detail',
  templateUrl: './plan-detail.component.html',
  styleUrls: ['./plan-detail.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class PlanDetailComponent implements OnInit {
  public planInfo;
  public dataStore = {
    level: ['低', '中', '高'], // 技巧等级.0:低，1：中，2：高 ,
    skillLevel: ['初级', '中级', '高级', '顶级']
  };

  constructor(private _planService: PlanService, private _route: ActivatedRoute,) {
    this._route.params
      .switchMap((params: Params) => {
        if (!params['classScheduleId']) {
          return;
        }
        this.getLessonPlanInfoDetail(params['classScheduleId']);
        return this._route.queryParams;
      }).subscribe((params: TrainClassScheduleVO) => {
    });
  }

  /**
   * @description 获取课时教学计划详情
   * @author ouyqx-691
   * @date 2018-4-2
   * @param scheduleId : 课时ID
   */
  getLessonPlanInfoDetail(scheduleId: number) {
    this._planService.getLessonPlanInfoDetail(scheduleId).subscribe((res) => {
      if (res.result === '0' && res.data) {
        this.planInfo = res.data;
      }
    });
  }

  ngOnInit() {
  }

}
